<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>轮胎管理系统</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container mt-4">
    <h1>轮胎管理系统</h1>

    <a href="/tires/add" class="btn btn-primary mb-3">添加新轮胎</a>
    <a href="/tires/usage" class="btn btn-info mb-3">查询使用记录</a>

    <table class="table table-striped">
        <thead>
        <tr>
            <th>轮胎号</th>
            <th>车牌号</th>
            <th>品牌</th>
            <th>型号</th>
            <th>装胎日期</th>
            <th>装胎公里数</th>
            <th>状态</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <tr th:each="tire : ${tires}">
            <td th:text="${tire.tireNumber}"></td>
            <td th:text="${tire.currentPlateNumber}"></td>
            <td th:text="${tire.tireBrand}"></td>
            <td th:text="${tire.tireModel}"></td>
            <td th:text="${tire.installDate}"></td>
            <td th:text="${tire.installMileage}"></td>
            <td>
                <span th:if="${tire.scrapDate == null}" class="badge bg-success">使用中</span>
                <span th:if="${tire.scrapDate != null}" class="badge bg-secondary">已报废</span>
            </td>
            <td>
                <a th:href="@{/tires/{id}(id=${tire.id})}" class="btn btn-sm btn-info">详情</a>
                <a th:href="@{/tires/{id}/repair(id=${tire.id})}" class="btn btn-sm btn-warning">修补</a>
            </td>
        </tr>
        </tbody>
    </table>
</div>
</body>
</html>